package demo;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class demo2 {
    public static void main(String[] args) throws UnknownHostException {
        //根据IP或者域名来获取该IP地址的对象
        InetAddress address1 = InetAddress.getByName("127.0.0.1");
        InetAddress address2 = InetAddress.getByName("www.baibu.com");
    }
}
